<template>
  <div class="basicarchives">
    <div class="table" v-if="!isshow">
<!--      <button  type="button" class="el-button el-button&#45;&#45;text el-button&#45;&#45;small" style="float: right; padding: 3px 0px;" @click="handleadd(0,'')">&lt;!&ndash;&ndash;&gt;&lt;!&ndash;&ndash;&gt;<span>添加基本信息</span></button>-->
      <el-button icon="el-icon-plus" type="primary" size="mini" style="float: right; "  @click="handleadd(0,'')" >
        添加基本信息
      </el-button>
      <el-form ref="form" :model="elder" label-width="80px" style="float: left; padding: 3px 0px;height: 20px">

          <el-input v-model="elder.elderlyName"  style="height: 20px" size="mini" placeholder="老人姓名 / 助记码"></el-input>

      </el-form>


      <el-button icon="el-icon-search" type="primary"  @click="search"  style="margin-left: 20px">
        查询
      </el-button>
    <el-table
      :data="list"

      v-loading="listLoading"
    >

      <el-table-column
        show-overflow-tooltip
        label="老人编号"
        prop="elderlyCode"
      ></el-table-column>
      <el-table-column

        prop="elderlyName"
        label="姓名"
        width="100"

      ></el-table-column>
      <el-table-column

        label="性别"
        prop="genderName"
        width="100"
      ></el-table-column>

      <el-table-column

        label="证件号"
        prop="cardNo"
      ></el-table-column>

      <el-table-column
        width="120"
        label="联系方式"
        prop="contactNumber"


      ></el-table-column>
      <el-table-column
        width="100"
        label="老人类型"
        prop="elderlyTypeName"
      ></el-table-column>
      <el-table-column  label="出生日期"  width="150">
        <template slot-scope="scope" v-if="scope.row.birth">
          {{scope.row.birth | parseTime('{y}-{m}-{d}')}}
        </template>
      </el-table-column>
      <el-table-column  label="农历生日"  width="150" >
        <template slot-scope="scope"v-if="scope.row.lunarCalendarBirth "  >
          {{scope.row.lunarCalendarBirth | parseTime('{y}-{m}-{d}')}}
        </template>
      </el-table-column>

      <el-table-column label="操作" prop="disabled"  width="320px"  fixed="right">
        <template slot-scope="scope">

          <el-button type="text" @click="handleinfo(scope.row.id,scope.row)" >查看 <i class="el-icon-tickets"></i></el-button>
          <el-button type="text"  @click="handlepath(scope.row.id,scope.row)">入住 <i class="el-icon-paperclip"></i></el-button>
<!--          <el-button type="text"  >评估 <i class="el-icon-tickets"></i></el-button>-->
          <el-button type="text"  @click="handleadd(scope.row.id,scope.row)" >修改 <i class="el-icon-edit"></i></el-button>
          <el-button type="text"  @click="doDelete(scope.$index, scope.row)">删除<i class="el-icon-delete"></i></el-button>

        </template>


      </el-table-column>

    </el-table>
      <el-pagination
        :background="background"

         :current-page="queryForm.currPageNo"
        :total="total"
        :page-size="queryForm.limit"
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
      ></el-pagination>



    </div>
  <el-tabs type="border-card" v-model="activeName"  tab-position="left"  v-if="isshow" @tab-click="handleClick">
    <button  type="button" class="el-button el-button--text el-button--small" style="float: right; padding: 3px 0px;" @click="back"><!----><!----><span>返回基础档案</span></button>
    <button  type="button" class="el-button el-button--text el-button--small" style="float: left; padding: 3px 0px;"  @click="stamp(0)" v-if="disabled&&activeName=='first'"><!----><!----><span>打印</span></button>
    <div ref="print" class="mytables">
      <h3 style="text-align: center;">基础档案信息表</h3>
    <table style="width: 100%" class="mytable" >

      <tr>
        <td class="ttitle">姓名</td>
        <td class="datalist"  colspan="1">{{form.elderlyName}}</td>
        <td class="ttitle">曾用名</td>
        <td class="datalist"  colspan="3">{{form.elderlyUsedName}}</td>

      </tr>
      <tr>
        <td class="ttitle">性别</td>
        <td class="datalist" colspan="1">{{form.genderName}}</td>
        <td class="ttitle">籍贯</td>
        <td class="datalist"  colspan="3">

          <el-cascader
            size="large"
            :disabled="disabled"
            style="text-align: center;border: 0"

            class="disabled"
            :options="provinceAndCity"
            v-model="selectedOptions"
            @change="handleChanges">
          </el-cascader>
          <span style="font-size: 14px;">/ {{form.censusAdress.xxaddress}}</span>
        </td>

      </tr>
      <tr>
        <td class="ttitle">出生日期</td>
        <td class="datalist" colspan="1">{{bridth | parseTime('{y}-{m}-{d}')}}</td>
        <td class="ttitle">农历日期</td>
        <td class="datalist" colspan="3">{{bridthn | parseTime('{y}-{m}-{d}')}}</td>
      </tr>
      <tr>
        <td class="ttitle">国籍</td>
        <td class="datalist" colspan="1">{{form.nationalityName}}</td>
        <td class="ttitle">民族</td>
        <td class="datalist" colspan="3">{{form.nationName}}</td>

      </tr>
      <tr>
        <td class="ttitle">身份证</td>
        <td class="datalist" colspan="1">{{form.cardNo}}</td>
        <td class="ttitle">社保卡</td>
        <td class="datalist" colspan="3">{{form.medicareNumber}}</td>

      </tr>

      <tr>
        <td class="ttitle">政治面貌</td>
        <td class="datalist" colspan="1">{{form.politicalStatusName}}</td>
        <td class="ttitle">婚姻状况</td>
        <td class="datalist" colspan="3">{{form.maritalStatusName}}</td>
      </tr>
      <tr>
        <td class="ttitle">文化程度</td>
        <td class="datalist" colspan="1">{{form.educationLevelName}}</td>
        <td class="ttitle">宗教信仰</td>
        <td class="datalist" colspan="3">{{form.religiousBeliefName}}</td>
      </tr>
      <tr>
        <td class="ttitle" rowspan="4">类别</td>
        <td class="datalist" >
         老人类型
        </td>
        <td class="datalist" colspan="4">
          {{form.elderlyTypeName}}
        </td>

      </tr>
      <tr>

        <td class="ttitle" >
          是否有残疾证
        </td>
        <td class="datalist" colspan="4">
          <span  v-if="form.haveCertificate==false">无</span>
          <span  v-if="form.haveCertificate==true">有</span>
        </td>

      </tr>
      <tr>

        <td class="ttitle" >
          是否购买保险
        </td>
        <td class="datalist" colspan="4">
          <span  v-if="purchaseInsurance==false">否</span>
          <span  v-if="purchaseInsurance==true">是</span>
        </td>
      </tr>
      <tr>

        <td class="ttitle" >
          经济来源


        </td>
        <td class="datalist" colspan="5">
          {{form.pocketbookName}}
        </td>
      </tr>
      <tr>
        <td class="ttitle">现住地址</td>
        <td class="datalist" colspan="5" >

          <el-cascader
            size="large"
            :disabled="disabled"
            style="text-align: center;border: 0"

            class="disabled"
            :options="provinceAndCity"
            v-model="selectedOptions"
            @change="handleChanges">
          </el-cascader>
          <span style="font-size: 14px;">/ {{form.liveAdress.xxaddress}}</span>
        </td>
      </tr>
      <tr>
        <td class="ttitle">联系电话</td>
        <td class="datalist"  colspan="5">
          {{form.contactNumber}}
        </td>
      </tr>
      <tr v-if="detal">
        <td class="ttitle" :rowspan=detal.length+1 >家庭成员 </td>
        <td  >姓名  </td>
        <td  >关系  </td>
        <td  >年龄  </td>
        <td >是否同住  </td>
        <td  >备注 </td>

      </tr>
      <tr v-for="(item,index) in detal" v-if="detal.length>0">
        <td class="ttitle" >          {{item.contactName}}
        </td>
        <td class="ttitle">          {{item.relationshipName}}
        </td>
        <td class="ttitle" >          {{item.age}}
        </td>
        <td class="ttitle" >         <span v-if="item.cohabit==false"> 否</span>
          <span v-if="item.cohabit==true"> 是</span>
        </td>
        <td class="ttitle" >          {{item.remark}}
        </td>
      </tr>
      <tr v-if="!detal">
        <td class="ttitle" :rowspan='1' >家庭成员 </td>
        <td  >姓名  </td>
        <td  >关系  </td>
        <td  >年龄  </td>
        <td >是否同住  </td>
        <td  >备注 </td>

      </tr>
      <tr v-if="!detal">
        <td class="ttitle" >
        </td>
        <td class="ttitle">
        </td>
        <td class="ttitle" >
        <td class="ttitle" >
        </td>
        <td class="ttitle" >
        </td>
        <td class="ttitle" >
        </td>
      </tr>
    </table>
    </div>
    <el-tab-pane name="first">
      <span slot="label"><vab-colorful-icon icon-class="survey" /> 基本信息</span>

      <table style="width: 100%"  v-if="disabled">
        <tr>
          <td class="ttitle" rowspan="6">基本信息</td>
          <td class="ttitle">姓名</td>
          <td>{{form.elderlyName}}</td>
          <td class="ttitle">曾用名</td>
          <td>{{form.elderlyUsedName}}</td>
          <td class="ttitle">性别</td>
          <td>{{form.genderName}}</td>
        </tr>
        <tr>
          <td class="ttitle">联系电话</td>
          <td>{{form.contactNumber}}</td>
          <td class="ttitle">政治面貌</td>
          <td>{{form.politicalStatusName}}</td>
          <td class="ttitle">婚姻状况</td>
          <td>{{form.maritalStatusName}}</td>
        </tr>
        <tr>
          <td class="ttitle">国籍</td>
          <td>{{form.nationalityName}}</td>
          <td class="ttitle">民族</td>
          <td>{{form.nationName}}</td>
          <td class="ttitle">经济来源</td>
          <td>{{form.pocketbookName}}</td>
        </tr>
        <tr>
          <td class="ttitle">出生日期</td>
          <td>{{bridth | parseTime('{y}-{m}-{d}')}}</td>
          <td class="ttitle">农历日期</td>
          <td colspan="3">{{bridthn | parseTime('{y}-{m}-{d}')}}</td>

        </tr>
        <tr>
          <td class="ttitle">户籍所在地</td>
          <td>

            <el-cascader
              size="large"
              :disabled="disabled"
              style="width: 100%;text-align: center"

              class="disabled"
              :options="provinceAndCity"
              v-model="selectedOptions"
              @change="handleChanges">
            </el-cascader>


          </td>
          <td class="ttitle">详细地址</td>
          <td colspan="3">{{form.censusAdress.xxaddress}}</td>
        </tr>
        <tr>
          <td class="ttitle">现居住地址</td>
          <td>

            <el-cascader
              size="large"
              :disabled="disabled"
              :class="{ 'active': disabled }"
              style="width: 100%"
              :options="provinceAndCity"
              v-model="selectedOption"
              @change="handleChange">
            </el-cascader>


          </td>
          <td class="ttitle">详细地址</td>
          <td colspan="3">{{form.liveAdress.xxaddress}}</td>
        </tr>
        <tr>
          <td class="ttitle" rowspan="1">医保信息</td>
          <td class="ttitle">医保编号</td>
          <td>{{form.medicareNumber}}</td>
          <td class="ttitle">医疗保险类型</td>
          <td colspan="3">{{form.medicalInsuranceTypeName}}</td>

        </tr>

        <tr>
          <td class="ttitle" rowspan="1">联系人信息</td>
          <td class="ttitle">联系人姓名</td>
          <td>{{form.emergencyContact.contactName}}</td>
          <td class="ttitle">联系人电话</td>
          <td >{{form.emergencyContact.contactNumber}}</td>
          <td class="ttitle">与老人关系</td>
          <td >{{form.emergencyContact.relationshipName}}</td>
        </tr>

        <tr>
          <td class="ttitle" rowspan="1">证件信息</td>
          <td class="ttitle">证件类型</td>
          <td >{{form.cardTypeName}}</td>
          <td class="ttitle">证件号</td>
          <td colspan="3">{{form.cardNo}}</td>

        </tr>

        <tr>
          <td class="ttitle" rowspan="3">其他信息</td>
          <td class="ttitle">习惯就医方式</td>
          <td>{{form.habitHospitalWayName}}</td>
          <td class="ttitle">习惯就医地点</td>
          <td >{{form.habitHospitalSite}}</td>
          <td class="ttitle">老人类型</td>
          <td >{{form.elderlyTypeName}}</td>
        </tr>
        <tr>
          <td class="ttitle">文化程度</td>
          <td>{{form.educationLevelName}}</td>
          <td class="ttitle">宗教信仰</td>
          <td colspan="3">{{form.religiousBeliefName}}</td>

        </tr>
        <tr>
          <td class="ttitle">购买保险</td>
          <td ><span  v-if="purchaseInsurance==false">否</span>
            <span  v-if="purchaseInsurance==true">是</span></td>
          <td class="ttitle">残疾证</td>
          <td colspan="3">
            <span  v-if="form.haveCertificate==false">无</span>
            <span  v-if="form.haveCertificate==true">有</span>
          </td>
        </tr>
      </table>
      <el-form ref="form" :model="form"  :rules="rules"   label-width="100px" style="padding-top:40px" class="form" v-if="!disabled">

        <el-row>
          <el-col :span="8">
              <el-form-item label="姓名" prop="elderlyName" >
                <el-input v-model="form.elderlyName" style="width:100%" v-if="!disabled">
                  <i slot="suffix">
                    <el-button  type="button" class="el-button  el-button--mini" style="background: #edf0f6;color: #4c6ca7;line-height: 3px;margin-top: 5px" :loading="cardLoading" @click="card">
                      <span>读医保卡</span>
                    </el-button >
                  </i>
<!--                  <i slot="suffix" style="margin-left: 10px;">-->
<!--                    <el-button  type="button" class="el-button  el-button&#45;&#45;mini" style="background: #edf0f6;color: #4c6ca7;line-height: 3px;margin-top: 5px" :loading="cardLoading" @click="card">-->
<!--                      <span>读身份证</span>-->
<!--                    </el-button >-->
<!--                  </i>-->
                </el-input>
                <span v-if="disabled">{{form.elderlyName}}</span>
              </el-form-item>
          </el-col>
          <el-col :span="8">
              <el-form-item label="曾用名" >
                <el-input v-model="form.elderlyUsedName" style="width:100%" v-if="!disabled"></el-input>
                <span v-if="disabled">{{form.elderlyUsedName}}</span>
              </el-form-item>
            </el-col >
          <el-col :span="8">
              <el-form-item label="联系电话" prop="contactNumber" >
                <el-input style="width:100%" v-model="form.contactNumber" v-if="!disabled" placeholder="请输入11位手机号" maxlength="11" oninput = "value=value.replace(/[^\d]/g,'')"></el-input>
                <span v-if="disabled">{{form.contactNumber}}</span>
              </el-form-item>
            </el-col>
          <el-col :span="8">
                <el-form-item label="婚姻状况" prop="maritalStatus">
                  <el-select v-model="form.maritalStatus" placeholder="请选择" style="width: 100%" v-if="!disabled">
                    <el-option
                      v-for="item in maritalStatuss"
                      :key="item.dcNo"
                      :label="item.name"
                      :value="item.dcNo">
                    </el-option>
                  </el-select>
                  <span  v-if="disabled">{{form.maritalStatusName}}</span>
                </el-form-item>
            </el-col>
          <el-col :span="8">
        <el-form-item label="医保编号" >
          <el-input v-model="form.medicareNumber" v-if="!disabled"></el-input>
          <span  v-if="disabled">{{form.medicareNumber}}</span>
        </el-form-item>
            </el-col>
          <el-col :span="8">
        <el-form-item label="医疗保险类型"  class="font" prop="medicalInsuranceType" >
          <el-select v-model="form.medicalInsuranceType" placeholder="请选择" style="width:100%" v-if="!disabled">
            <el-option
              v-for="item in medicalInsuranceTypes"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.medicalInsuranceTypeName}}</span>
        </el-form-item>
            </el-col>
          <el-col :span="8">
            <el-form-item label="政治面貌" required>
            <el-select v-model="form.politicalStatus" placeholder="请选择" style="width:100%" v-if="!disabled">
              <el-option
                v-for="item in politicalStatuss"
                :key="item.dcNo"
                :label="item.name"
                :value="item.dcNo">
              </el-option>
            </el-select>
            <span  v-if="disabled">{{form.politicalStatusName}}</span>
          </el-form-item>
            </el-col >
          <el-col :span="8">
        <el-form-item label="国籍" prop="nationality">
          <el-select v-model="form.nationality" placeholder="请选择" style="width:100%" v-if="!disabled">
            <el-option
              v-for="item in nationalitys"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.nationalityName}}</span>
        </el-form-item>
            </el-col>
          <el-col :span="8">
        <el-form-item label="民族" prop="nation">
          <el-select v-model="form.nation" placehsolder="请选择" style="width:100%"
                     v-if="!disabled"
          >
            <el-option
              v-for="item in nations"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.nationName}}</span>
        </el-form-item>
            </el-col>
          <el-col :span="8">
            <el-form-item label="经济来源" prop="pocketbooks">
              <el-select v-model="form.pocketbook" placehsolder="请选择" style="width:100%"
                         v-if="!disabled"
              >
                <el-option
                  v-for="item in pocketbooks"
                  :key="item.dcNo"
                  :label="item.name"
                  :value="item.dcNo">
                </el-option>
              </el-select>
              <span  v-if="disabled">{{form.pocketbookName}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">

        <el-form-item label="性别"   >
          <template v-if="!disabled">
            <el-radio v-model="form.gender" :label=1 >男</el-radio>
            <el-radio v-model="form.gender" :label=0>女</el-radio>
          </template>
          <span  v-if="disabled">{{form.genderName}}</span>
        </el-form-item>
            </el-col >
        </el-row>

        <el-divider></el-divider>





        <el-row>
          <el-col :span="8">
        <el-form-item label="出生日期" required>
          <el-date-picker
            v-if="!disabled"
            v-model="form.birth"
            type="date"
            @change="changetime"
             style="width: 100%"
            value-format="yyyy-MM-dd"
            placeholder="出生日期">
          </el-date-picker>
          <span  v-if="disabled">{{bridth | parseTime('{y}-{m}-{d}')}}</span>

        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="农历日期" >
          <el-date-picker
            v-if="!disabled"
            style="width: 100%"
            value-format="yyyy-MM-dd"
            v-model="form.lunarCalendarBirth"
            type="date"
            placeholder="农历日期">
          </el-date-picker>
          <span  v-if="disabled">{{bridthn | parseTime('{y}-{m}-{d}')}}</span>
        </el-form-item>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="8">
        <el-form-item label="户籍所在地" required >
          <el-cascader
            size="large"
            :disabled="disabled"
            style="width: 100%"
            class="disabled"
            :options="provinceAndCity"
            v-model="selectedOptions"
            @change="handleChanges">
          </el-cascader>


        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="详细地址" required>
          <el-input v-model="form.censusAdress.xxaddress"  v-if="!disabled" placeholder="请填写街道（村镇）及门牌号"  style="width: 100%"></el-input>
          <span  v-if="disabled">{{form.censusAdress.xxaddress}}</span>
        </el-form-item>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="8">
        <el-form-item label="现居住地址" required>
          <el-cascader
            size="large"
            :disabled="disabled"
            :class="{ 'active': disabled }"
           style="width: 100%"
            :options="provinceAndCity"
            v-model="selectedOption"
            @change="handleChange">
          </el-cascader>



        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="详细地址" required >
          <el-input  v-model="form.liveAdress.xxaddress"   v-if="!disabled" style="width: 100%" placeholder="请填写街道（村镇）及门牌号"  ></el-input>
          <span  v-if="disabled">{{form.liveAdress.xxaddress}}</span>
        </el-form-item>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="8">
        <el-form-item label="证件类型" required>
          <el-select v-model="form.cardType" placeholder="请选择"   style="width:100%"  v-if="!disabled">
            <el-option

              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.cardTypeName}}</span>
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="证件号" required>
          <el-input v-model="form.cardNo"   style="width:100%" v-if="!disabled"></el-input>
          <span  v-if="disabled">{{form.cardNo}}</span>
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-divider></el-divider>

          <el-col :span="8">
            <el-form-item label="习惯就医方式" required class="font">
              <el-select v-model="form.habitHospitalWay" style="width: 100%" placeholder="请选择" v-if="!disabled">
                <el-option
                  v-for="item in habitHospitalWays"
                  :key="item.dcNo"
                  :label="item.name"
                  :value="item.dcNo">
                </el-option>
              </el-select>
              <span  v-if="disabled">{{form.habitHospitalWayName}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="习惯就医地点">
              <el-input v-model="form.habitHospitalSite"   style="width:100%" v-if="!disabled"></el-input>
              <span  v-if="disabled">{{form.habitHospitalSite}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="8">
        <el-form-item label="老人类型" prop="elderlyType">
          <el-select v-model="form.elderlyType" placeholder="请选择"  style="width:100%" v-if="!disabled">
            <el-option

              v-for="item in elderlyTypes"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>

          </el-select>
          <span  v-if="disabled">{{form.elderlyTypeName}}</span>
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="文化程度" required >
          <el-select v-model="form.educationLevel" placeholder="请选择"  style="width:100%"  v-if="!disabled">
            <el-option

              v-for="item in educationLevels"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.educationLevelName}}</span>
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="宗教信仰" required>
          <el-select v-model="form.religiousBelief" placeholder="请选择"     style="width: 100%"  v-if="!disabled">
            <el-option

              v-for="item in religiousBeliefs"
              :key="item.dcNo"
              :label="item.name"
              :value="item.dcNo">
            </el-option>
          </el-select>
          <span  v-if="disabled">{{form.religiousBeliefName}}</span>
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="购买保险" required>
          <el-select v-model="form.purchaseInsurance" placeholder="请选择"  style="width: 100%" v-if="!disabled">
            <el-option

              v-for="item in purchaseInsurances"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>

          </el-select>


          <span  v-if="disabled">

              <span  v-if="purchaseInsurance==false">无</span>
               <span  v-if="purchaseInsurance==true">有</span>
          </span>
        </el-form-item>
          </el-col>
            <el-col :span="8">

            <el-form-item label="残疾证" required>
              <el-select v-model="form.haveCertificate" placeholder="请选择"  style="width: 100%" v-if="!disabled">
                <el-option

                  v-for="item in haveCertificates"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>

              </el-select>


              <span  v-if="disabled">

              <span  v-if="form.haveCertificate==false">否</span>
               <span  v-if="form.haveCertificate==true">是</span>
          </span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider></el-divider>

        <el-row>
          <el-col :span="8">
            <el-form-item label="联系人姓名"  required  >
              <el-input v-model="form.emergencyContact.contactName" style="width: 100%" v-if="!disabled" placeholder="联系人姓名"></el-input>
              <span  v-if="disabled">{{form.emergencyContact.contactName}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="联系电话" required >
              <el-input v-model="form.emergencyContact.contactNumber" v-if="!disabled"style="width: 100%" oninput = "value=value.replace(/[^\d]/g,'')" maxlength="11" placeholder="请输入11位手机号"></el-input>
              <span  v-if="disabled">{{form.emergencyContact.contactNumber}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="与老人关系" required>
              <el-select v-model="form.emergencyContact.relationship" style="width: 100%" placeholder="请选择" v-if="!disabled">
                <el-option
                  v-for="item in relationships"
                  :key="item.dcNo"
                  :label="item.name"
                  :value="item.dcNo">
                </el-option>
              </el-select>
              <span  v-if="disabled">{{form.emergencyContact.relationshipName}}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-button   type="success" style="    position: fixed;bottom: 20px; right: 220px; " @click="back" v-if="!disabled" >
        取消
      </el-button>
<!--      <el-button style="float: right; margin-left: 10px" @click="back" v-if="!disabled">取消</el-button>-->
<!--      <el-button style="float: right; "   @click="save('form')" v-if="!disabled">确 定</el-button>-->
      <el-button  type="primary" style="position: fixed;bottom: 20px; right: 120px; "@click="save('form')" v-if="!disabled"  v-preventReClick >
        保存
      </el-button>

    </el-tab-pane>
    <el-tab-pane>
      <span slot="label"><vab-colorful-icon icon-class="video_file" /> 家属资料</span>
      <familyinformation :elderlyCode="elderlyCode" :dictionary="dictionary" :disabled="disabled" ref="familyinformation"></familyinformation>
    </el-tab-pane>
    <el-tab-pane>
      <span slot="label"><vab-colorful-icon icon-class="planner" /> 现病史</span>
      <illness :elderlyCode="elderlyCode" :dictionary="dictionary" :disabled="disabled"></illness>
    </el-tab-pane>
    <el-tab-pane name="pharmacy">
      <span slot="label"><vab-colorful-icon icon-class="plus" /> 用药史</span>
      <pharmacy :elderlyCode="elderlyCode" :dictionary="dictionary" :diseasess="diseasess" :disabled="disabled" ref="diseasess"></pharmacy>
    </el-tab-pane>
    <el-tab-pane>
      <span slot="label"><vab-colorful-icon icon-class="clock" /> 既往史</span>
      <past :elderlyCode="elderlyCode" :dictionary="dictionary" :disabled="disabled"></past>
    </el-tab-pane>
    <el-tab-pane>
      <span slot="label"><vab-colorful-icon icon-class="businessman" /> 家族史</span>
      <familyhistory :elderlyCode="elderlyCode" :dictionary="dictionary" :disabled="disabled"></familyhistory>
    </el-tab-pane>
    <el-tab-pane name="logList" v-if="ischeckinhistory">
      <span slot="label"><vab-colorful-icon icon-class="survey" /> 入住记录</span>
      <div class="logTable" v-loading="checkinhistoryLoading">
        <div class="tip" v-if="!checkinhistoryList || !checkinhistoryList.length">暂无入住记录</div>
        <div class="rowBox" v-else v-for="item in checkinhistoryList">
          <el-form label-width="100px">
            <el-form-item label="入住编号：">
              {{ item.checkInMark }}
            </el-form-item>
            <el-form-item label="入住时间：">
              {{ item.checkedInTime | parseTime('{y}-{m}-{d}') }}
            </el-form-item>
            <el-form-item label="入住地址：">
              {{ item.checkInBed }}
            </el-form-item>
            <el-form-item label="入住状态：">
                <el-tag v-if="item.retreat" type="info">已退住</el-tag>
                <el-tag v-else type="success">入住中</el-tag>
            </el-form-item>
            <el-form-item v-if="item.retreatTime" label="退住时间：">
              {{ item.retreatTime | parseTime('{y}-{m}-{d} {h}:{i}') }}
            </el-form-item>
          </el-form>
        </div>
      </div>
    </el-tab-pane>
  </el-tabs>

  </div>

</template>

<script>

    import calendar from 'solarday2lunarday'
    import { searchdiseasesName } from "@/api/pharmacy"
    import { regionDataPlus} from 'element-china-area-data'
    import { revise } from "@/api/basicarchives"
    import illness from "./illness/illness";
    import pharmacy from "./pharmacy/pharmacy";
    import past from "./past/past";
    import familyinformation from "./familyinformation/familyinformation";
    import familyhistory from "./familyhistory/familyhistory";
    import { add } from "@/api/basicarchives"
    import { search ,searchElderlyOfCheckInStatus,searchelderlyfile,familymember} from "@/api/basicarchives"
    import { checkinhistory } from "@/api/pharmacy"
    import { del } from "@/api/basicarchives"
    import { parseTime} from "@/utils/index";
    import Print from '@/utils/print'
    import Vue from 'vue'
    import {city} from "@/assets/city";
    import {date} from "@/utils/validate";
    import {sendmsgss} from "@/api/equipmentDirective";
    Vue.use(Print)
    export default {
        name: "Basicarchives",
        components: {illness,pharmacy,past,familyhistory,familyinformation},
        filters:{
            parseTime:parseTime
        },
        data() {
            return {
                elder:{

                },
                activeName:"first",
                dictionary:"",
                longsocket:undefined,
                pocketbooks:"",
                habitHospitalWays:"",
                diseasess:"",
                background:true,
                disabled:false,
                ischeckinhistory:false,
                cardLoading:false,
                id:0,
                total:0,
                list:[],
                detal:[],
                elderlyCode:"",
                isshow:false,
                provinceAndCity: regionDataPlus,
                selectedOptions: ["370000","370200","370203"],
                selectedOption: ["370000","370200","370203"],
                rules: {
                    elderlyName: [
                        { required: true, message: '请输入老人姓名', trigger: 'blur' },

                    ],
                    contactNumber: [
                        { required: true, message: '请输入11位手机号', trigger: 'blur' },

                    ],
                    medicalInsuranceType: [
                        { required: true, message: '请选择医保类型', trigger: 'change'},

                    ],
                    maritalStatus: [
                        { required: true, message: '请选择婚姻状况', trigger: 'change' },

                    ],
                    nationality: [
                        { required: true, message: '请选择国籍', trigger: 'change' },

                    ],
                    nation: [
                        { required: true, message: '请选择民族', trigger: 'change' },

                    ],
                    elderlyType: [
                        { required: true, message: '老人类型', trigger: 'blur' },

                    ],
                },
                form:{
                    cardNo:"",
                    haveCertificate:false,//是否有残疾证
                    habitHospitalWay:7,//习惯就医方式
                    habitHospitalSite:"",//习惯就医地点
                    mnemonicCode:"",//老人姓名助记码
                    pocketbook:2,//经济来源
                    birth:"",//出生日期
                    elderlyName:"",//老人姓名
                    nationality:1,//国籍
                    elderlyType:1,//老人类型
                    elderlyUsedName:"",//老人曾用名
                    gender:'1',//性别
                    cardType:100001,//身份类型
                    medicalInsuranceType:1,//医保类型
                    institutionNumber:"",//所属机构编号
                    lunarCalendarBirth:"",//农历生日
                    maritalStatus:1,//婚姻状况
                    medicareNumber:"",//医保编号
                    nation:1,//民族
                    educationLevel:1,//文化程度
                    politicalStatus:13,//政治面貌
                    purchaseInsurance:false,//是否购买保险
                    religiousBelief:1,//宗教信仰
                    contactNumber:"",//联系电话
                    censusAdress:{
                        city:"",//市
                        county:"",//县/区
                        province:"",//省份
                        xxaddress:"",//详细地址
                    },
                    emergencyContact:{
                        contactName:"",//联系人姓名
                        contactNumber:"",//联系电话
                        relationship:1,//与老人关系
                    },
                    liveAdress:{
                        city:"",//市
                        county:"",//县/区
                        province:"",//省份
                        xxaddress:"",//详细地址
                    }

                },


                radio:1,
                value:100001,
                options: [{
                    value: 100001,
                    label: '居民身份证'
                }, {
                    value: 100002,
                    label: '军人证'
                },
                    {
                        value: 100003,
                        label: '护照'
                    },
                    {
                        value: 100004,
                        label: '户口本'
                    },
                    {
                        value: 100005,
                        label: '外国人永久居留证'
                    },
                    {
                        value: 100006,
                        label: '武警证'
                    },
                    {
                        value: 100007,
                        label: '公章'
                    },
                    {
                        value: 100008,
                        label: '港澳居民来往内地通行证'
                    },
                    {
                        value: 100009,
                        label: '台湾居民来往大陆通行证'
                    },
                    {
                        value: 100010,
                        label: '其他证件'
                    },
                ],
                elderlyType:"",
                elderlyTypes:{

                },
                bridthn:"",
                bridth:"",
                nationality:"",
                nationalitys:{

                },

                nation:"",
                nations:"",
                educationLevel:"",
                educationLevels:{

                },
                politicalStatu:"",
                politicalStatus:"",
                politicalStatuss:{

                },
                religiousBelief:"",
                religiousBeliefs:{

                },
                maritalStatus:"",
                maritalStatuss:{

                },
                medicalInsuranceType:'',
                medicalInsuranceTypes:"",
                relationship:"",
                relationships:{},
                purchaseInsurance:false,
                purchaseInsurances:[{
                  value:true,
                  label:"是",

                },
                    {
                        value: false,
                        label: '否'
                    }
                ],
                haveCertificates:[{
                    value:true,
                    label:"有",

                },
                    {
                        value: false,
                        label: '无'
                    }
                ],
                queryForm: {
                    currPageNo: 1,
                    limit: 8,
                    institutionNumber:"",
                },
                DialogVisible:false,

                listLoading:true,
                checkinhistoryList: [],
                checkinhistoryLoading: false,
            }

        },
        created(){
            this.dictionary=JSON.parse(localStorage.getItem("dictionary"))
            setTimeout(() => {
                this.queryForm.institutionNumber= (localStorage.getItem("institutionNumber"));
            }, 1000);
            // this.form.institutionNumber= (localStorage.getItem("institutionNumber"));

            for(var i=0;i<this.dictionary.length;i++){
                if(this.dictionary[i].mark=="nationality"){

                    this.nationalitys=(this.dictionary[i].childs)

                }else if(this.dictionary[i].mark=="nation"){
                    this.nations=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="politicalStatus"){
                    this.politicalStatuss=(this.dictionary[i].childs)
                    this.politicalStatus=this.dictionary[i].childs[12].dcNo
                    this.politicalStatu=this.dictionary[i].childs[12].dcNo
                }else if(this.dictionary[i].mark=="maritalStatus"){
                    this.maritalStatuss=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="relationship"){
                    this.relationships=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="elderlyType"){
                    this.elderlyTypes=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="religiousBelief"){
                    this.religiousBeliefs=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="educationLevel"){
                    this.educationLevels=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="medicalInsuranceType"){
                    this.medicalInsuranceTypes=(this.dictionary[i].childs)
                }else if(this.dictionary[i].mark=="pocketbook"){
                    this.pocketbooks=(this.dictionary[i].childs)

                }else if(this.dictionary[i].mark=="hospitalway"){
                    this.habitHospitalWays=(this.dictionary[i].childs)

                }
            }

            setTimeout(() => {

              this.search()
            }, 1000);

        },
        methods:{
          card(){

            this.cardLoading=true
            this.socketApi.getLink().then(value => {
              this.longsocket = value
              sendmsgss(this.longsocket, 'sendmsgss', '读取社保卡', ).then(value => {
                console.log(value.Data)
                this.form.elderlyName=value.Data.PersonName || ''
                if(value.Data.Gender=='1'){
                      this.form.gender=1 || ''
                }else {
                  this.form.gender=0 || ''
                }

                this.form.birth= (date(value.Data.Birthday)) || ''
                this.changetime(date(value.Data.Birthday))
                this.form.cardNo=value.Data.PersonIDNumber || ''
                let citys=''
                for(let item  in city.county_list){
                  if(city.county_list[item]==value.Data.Area){
                    citys=item.toString()
                  }
                }
                let  str=citys || ''
                let  str1=citys || ''
                str1 = str1.slice(0, 2)+'0000' || ''
                str = str.slice(0, 4)+'00' || ''
                let censusAdress=[str1,str,citys]
                this.selectedOptions = censusAdress
                let liveAdress=[str1,str,citys]
                this.selectedOption = liveAdress
                this.cardLoading=false

              }).catch(err => {
                this.cardLoading=false
                this.$message.error(err)
                this.socketApi.closeWs()
              })
            }).catch(err =>{
              this.cardLoading=false
              this.$message.error('连接失败，请打开托盘程序')
            })
          },
            stamp(size){
                this.$print(this.$refs.print, { size })
            },
          checkinhistory(){
              this.checkinhistoryLoading = true
              console.log(this.elderlyCode)
              if(this.elderlyCode){
                  let elderlyCode=this.elderlyCode
                  checkinhistory({elderlyCode}).then(res =>{
                      console.log(res)
                      this.checkinhistoryList=res.data
                      this.checkinhistoryLoading = false
                  })
              }else {

              }


          },


          handleinfo(id,data){
              this.activeName='first'
              this.disabled=true
            this.DialogVisible=true
              this.ischeckinhistory=true

              this.isshow=true
            this.elderlyCode=data.elderlyCode
            this.form={
              ...data
            }

              let elderlyCode=this.elderlyCode
              familymember({elderlyCode}).then(res =>{
                  console.log(res)
                  this.detal=res.data

              })

            this.purchaseInsurance=data.purchaseInsurance
            this.radio = data.gender
            this.religiousBelief = data.religiousBelief
            this.elderlyType = data.elderlyType
            this.medicalInsuranceType = data.medicalInsuranceType
            this.nationality = data.nationality
            this.politicalStatus = data.politicalStatus
            this.nation = data.nation
            this.maritalStatus = data.maritalStatus
            this.educationLevel = data.educationLevel
            this.bridth = data.birth
            this.bridthn = data.lunarCalendarBirth
            this.relationship = data.emergencyContact.relationship
            let censusAdress=[data.censusAdress.province,data.censusAdress.city,data.censusAdress.county]
            this.selectedOptions = censusAdress
            let liveAdress=[data.liveAdress.province,data.liveAdress.city,data.liveAdress.county]
            this.selectedOption = liveAdress
            console.log(this.selectedOption)
            this.cardType = data.cardType


          },
            handleClick(tab, event){
             if(tab.name == 'pharmacy'){
               console.log(this.elderlyCode)
                    this.$refs.diseasess.search()
                     console.log(this.elderlyCode)
                     if (this.elderlyCode) {
                         let elderlyCode = this.elderlyCode
                         searchdiseasesName({elderlyCode}).then(res => {
                             console.log(res.data)

                             this.diseasess = res.data
                             console.log(this.diseasess)

                         })
                     } else {

                     }



             }

             if(tab.name == 'logList'){
              this.checkinhistory()
             }
            },
            handlepath(id,row){
                     let elderlyCode=row.elderlyCode
                    searchElderlyOfCheckInStatus({elderlyCode}).then(res =>{
                        console.log(res)
                        if(res.data==true){
                            this.$message({
                                message: '老人正在入住，不能重复办理入住',
                                type: 'warning'
                            });
                        }else {
                            this.$router.push({ name:'movesets', params: { id: 2,name:row.elderlyName,code:row.elderlyCode,institutionName:row.institutionName,liveAdress:row.liveAdress} })
                        }

                    })


            },
            handleadd(id,data){
                this.activeName='first'
              console.log(data)
                this.id = id
                this.ischeckinhistory=false
                if(id>0){
                    this.disabled=false
                    this.isshow=true

                    this.elderlyCode=data.elderlyCode
                    this.form={
                        ...data
                    }

                     this.radio = data.gender
                     this.religiousBelief = data.religiousBelief
                     this.elderlyType = data.elderlyType
                     this.medicalInsuranceType = data.medicalInsuranceType
                    this.nationality = data.nationality
                    this.politicalStatus = data.politicalStatus
                    this.nation = data.nation
                    this.maritalStatus = data.maritalStatus
                    this.educationLevel = data.educationLevel
                    this.bridth = data.birth
                    this.bridthn = data.lunarCalendarBirth
                    this.relationship = data.emergencyContact.relationship
                    let censusAdress=[data.censusAdress.province,data.censusAdress.city,data.censusAdress.county]
                     this.selectedOptions = censusAdress
                    let liveAdress=[data.liveAdress.province,data.liveAdress.city,data.liveAdress.county]
                    this.selectedOption = liveAdress
                    console.log(this.selectedOption)
                    this.cardType = data.cardType
                }
                else {
                    this.disabled = false
                     this.elderlyCode=""
                    this.isshow = true


                    // this.form.elderlyName=""
                    //  this.form.elderlyUsedName=""
                    //  this.form.medicareNumber=""
                    //  this.form.medicalInsuranceType=""
                    //   this.nationality=""
                    //   this.nation=""
                    //   this.form.contactNumber=""
                    //   this.politicalStatus=this.politicalStatu
                    //   this.maritalStatus=""
                    //   this.form.emergencyContact.contactName=""
                    //   this.form.emergencyContact.contactNumber=""
                    //   this.bridth=""
                    //   this.bridthn=""
                    //   this.form.liveAdress.xxaddress=""
                    //   this.form.censusAdress.xxaddress=""
                    //
                    //   this.relationship=""
                    //   this.selectedOptions=[]
                    //   this.selectedOption=[]
                    //   this.value="100001"
                    //   this.form.cardNo=""
                    //   this.elderlyType=""
                    //   this.educationLevel=""
                    //   this.religiousBelief=""
                    //   this.purchaseInsurance=""
                    //   this.radio=1

                    this.form = {
                        haveCertificate:false,//是否有残疾证
                        habitHospitalWay:7,//习惯就医方式
                        habitHospitalSite:"",//习惯就医地点
                        mnemonicCode:"",//老人姓名助记码
                        pocketbook:2,//经济来源
                        cardNo: "",
                        birth:"",//出生日期
                        elderlyName: "",//老人姓名
                        nationality: 1,//国籍
                        elderlyType: 1,//老人类型
                        elderlyUsedName: "",//老人曾用名
                        gender: 1,//性别
                        cardType: 100001,
                        medicalInsuranceType: 1,//医保类型
                        institutionNumber: localStorage.getItem("institutionNumber"),//所属机构编号
                        lunarCalendarBirth: "",//农历生日
                        maritalStatus: 1,//婚姻状况
                        medicareNumber: "",//医保编号
                        nation: 1,//民族
                        educationLevel: 1,//文化程度
                        politicalStatus: 13,//政治面貌
                        purchaseInsurance: false,//是否购买保险
                        religiousBelief: 1,//宗教信仰
                        contactNumber: "",//联系电话
                        censusAdress: {
                            city: "370200",//市
                            county: "370203",//县/区
                            province: "370000",//省份
                            xxaddress: "",//详细地址
                        },
                        emergencyContact: {
                            contactName: "",//联系人姓名
                            contactNumber: "",//联系电话
                            relationship: 1,//与老人关系
                        },
                        liveAdress: {
                            city: "370200",//市
                            county: "370203",//县/区
                            province: "370000",//省份
                            xxaddress: "",//详细地址
                        }

                    }

                }
                this.DialogVisible=true
                this.$nextTick(function () {
                    console.log(this.$refs.familyinformation.list)

                })


            },
            handleChange (value) {
                     console.log(value)
                this.form.liveAdress.province=value[0]
                this.form.liveAdress.county=value[2]
                this.form.liveAdress.city=value[1]
            },
            handleChanges (value) {
                console.log(value)
                this.form.censusAdress.province=value[0]
                this.form.censusAdress.county=value[2]
                this.form.censusAdress.city=value[1]
            },
            back(){
                this.isshow=false
            },
            changetime(value){
                console.log(calendar.solar2lunar(value))
                let  year=calendar.solar2lunar(value).lunarYear
                let  month=calendar.solar2lunar(value).lunarMonth
                let day =calendar.solar2lunar(value).lunarDay
                 if(month<10){
                     month='0'+month
                 }
                 if(day<10){
                      day='0'+day
                 }
                let time= (year+'-'+month+'-'+day)
                 this.form.lunarCalendarBirth=time
            },

            save(formName){
              console.log(this.form)
                // this.form.gender = this.radio
                this.$refs[formName].validate(async (valid) => {

                    if (valid) {
                        // this.form.nationality = this.nationality
                        // this.form.nation = this.nation
                        // this.form.politicalStatus = this.politicalStatus
                        // this.form.maritalStatus = this.maritalStatus
                        // this.form.emergencyContact.relationship = this.relationship
                        // this.form.birth = this.bridth
                        // this.form.lunarCalendarBirth = this.bridthn
                        // this.form.religiousBelief = this.religiousBelief
                        // this.form.purchaseInsurance = this.purchaseInsurance
                        // this.form.educationLevel = this.educationLevel
                        // this.form.elderlyType= this.elderlyType
                        // this.form.cardType= this.value
                        // if(this.form.censusAdress.province==""){
                        //
                        //     this.form.censusAdress.province="370000"
                        //     this.form.censusAdress.county="370200"
                        //     this.form.censusAdress.city="370203"
                        // }
                        // if(this.form.liveAdress.province==""){
                        //     this.form.liveAdress.province="370000"
                        //     this.form.liveAdress.county="370200"
                        //     this.form.liveAdress.city="370203"
                        // }
                        // this.form.medicalInsuranceType= this.medicalInsuranceType

                        if(this.id>0){
                            console.log(this.radio)


                            const {code} = await revise(this.form);
                            if(code==200){
                                this.$message({
                                        message: "修改成功",
                                        type: 'success'
                                    }
                                );
                                // let elderlyCode = this.elderlyCode
                                // searchelderlyfile({elderlyCode}).then(res => {
                                //     console.log(res)
                                //     this.form={
                                //         ...res.data
                                //     }
                                //
                                //     this.radio = res.data.gender
                                //     this.religiousBelief = res.data.religiousBelief
                                //     this.elderlyType = res.data.elderlyType
                                //     this.medicalInsuranceType = res.data.medicalInsuranceType
                                //     this.nationality = res.data.nationality
                                //     this.politicalStatus = res.data.politicalStatus
                                //     this.nation = res.data.nation
                                //     this.maritalStatus = res.data.maritalStatus
                                //     this.educationLevel = res.data.educationLevel
                                //     this.bridth = res.data.birth
                                //     this.bridthn = res.data.lunarCalendarBirth
                                //     this.relationship = res.data.emergencyContact.relationship
                                //     let censusAdress=[res.data.censusAdress.province,res.data.censusAdress.city,res.data.censusAdress.county]
                                //     this.selectedOptions = censusAdress
                                //     let liveAdress=[res.data.liveAdress.province,res.data.liveAdress.city,res.data.liveAdress.county]
                                //     this.selectedOption = liveAdress
                                //     console.log(this.selectedOption)
                                //     this.cardType = res.data.cardType
                                //
                                // })
                                this.search()
                                this.id=this.form.id

                                    this.form.version++

                                console.log(this.form)

                            }else {
                                return false
                            }
                        }else{

                          // this.form.nationality = this.nationality
                          // this.form.nation = this.nation
                          // this.form.politicalStatus = this.politicalStatus
                          // this.form.maritalStatus = this.maritalStatus
                          // this.form.emergencyContact.relationship = this.relationship
                          // this.form.birth = this.bridth
                          // // this.form.lunarCalendarBirth = this.bridthn
                          // this.form.religiousBelief = this.religiousBelief
                          // this.form.purchaseInsurance = this.purchaseInsurance
                          // this.form.educationLevel = this.educationLevel
                          // this.form.elderlyType= this.elderlyType
                          // this.form.cardType= this.value
                          // this.form.medicalInsuranceType= this.medicalInsuranceType

                            console.log(this.form)
                            const {code,data} = await add(this.form);
                            if(code==200){
                                this.$message({
                                        message: "添加成功",
                                        type: 'success'
                                    }
                                );
                                console.log(data)
                                this.elderlyCode=data
                                this.search()

                            }else {
                                return false
                            }
                        }



                    } else {

                        return false;
                    }
                });
            },

            search(id,data){
               this.id=id
             //  if(this.elder.elderlyName){
             //
             //      if(this.elder.elderlyName.length>5){
             //
             //          this.queryForm.elderlyName=""
             //          this.queryForm.cardNo=this.elder.elderlyName
             //
             //      }else  {
             //
             //          this.queryForm.cardNo=""
             //          this.queryForm.elderlyName=this.elder.elderlyName
             //      }
             //
             //
             //
             //  }else {
             //      this.queryForm.cardNo=""
             //      this.queryForm.elderlyName=""
             //  }
             //
             // console.log(this.id)
                if(this.elder.elderlyName){
                    this.queryForm.elderlyNameOrMcode=this.elder.elderlyName
                }else {
                    this.queryForm.elderlyNameOrMcode=""
                }
                if(this.id==undefined){

                }else {
                    this.queryForm.currPageNo=1
                }

                search(this.queryForm).then(res =>{
                    // this.listLoading = true;
                      this.list=res.data.data
                     this.total=res.data.total
                    setTimeout(() => {
                        this.listLoading = false;
                    }, 500);
                    // this.queryForm.currPageNo=1
                })

            },
            handleSizeChange(val) {
                this.queryForm.limit = val;
                this.search();
            },
            handleCurrentChange(val) {
                this.queryForm.currPageNo = val;
                this.search();
            },
            doDelete(index,row) {
                let elderlyCode=row.elderlyCode
                console.log(row)

                if (row.id) {
                    this.$baseConfirm("你确定要删除当前项吗", null, async () => {
                        const {code, msg } = await del(({elderlyCode}));
                        if(code==200){
                            this.$baseMessage("删除成功");
                            this.search()

                        }else {
                            this.$baseMessage("删除失败");
                        }
                    });
                }
            },
        }
    }
</script>

<style scoped>
  .mytables{
    display: none ;
    padding-top: 10px;
  }
  .basicarchives >>> .is-disabled .el-input__inner{
    border: 0 !important;
    background-color:white !important;
    color: #333333;
    text-align: center;
  }
  .basicarchives >>> .is-disabled .el-input__suffix{
   display: none !important;
  }
  .basicarchives >>> .el-tabs--left .el-tabs__item.is-left {
     text-align: initial !important;
  }
  .font >>> .el-form-item__label{
    font-size: 12px;
  }

  .logTable{border:1px solid #ccc;border-bottom: 0;margin-top: 26px;}
  .tip{text-align: center;margin-top: 100px;padding-bottom: 100px;border-bottom: 1px solid #ccc;}
  .rowBox{border-bottom: 1px solid #ccc;padding: 8px 0;}

  .logTable >>> .el-form-item--small.el-form-item{margin-bottom: 0;}
  .basicarchives{
    height: 950px;
  }
  .basicarchives .el-tabs {
    height: 100%;
  }
  .basicarchives >>>.el-tabs__nav-prev{
    display: none;
  }
  .basicarchives >>> .el-tabs__nav-next{
    display: none;
  }
  table
  {
    border-collapse: collapse;
    margin: 0 auto;
    text-align: center;
  }
  table td, table th
  {
    border: 1px solid rgba(59,65,81,.3);
    height: 30px;
  }
  table .ttitle
  {
    background-color: #F5FAFA;
    width: 100px;
  }
  table tr:nth-child(odd)
  {
    background: #fff;
  }

  .disabled >>>.el-input__suffix-inner{
    display: none !important;
  }
  .is-disabled>>> .el-input__suffix-inner{
    display: none !important;
  }

  .datalist >>> .disabled .el-input__inner{
    color:#333333;border: 0;padding: 0;
    text-align: right;
  }
  .mytable
  {
    border-collapse: collapse;
    margin: 0 auto;
    text-align: center;
  }
  .mytable td, table th
  {
    border: 1px solid rgba(59,65,81,.3);
    height: 45px;
  }
  .mytable .ttitle
  {
    background-color: #F5FAFA;
    width: 10%;
  }
  .mytable tr:nth-child(odd)
  {
    background: #fff;
  }
  .mytable .datalist{
    width: 30%;

  }
  .form>>>.el-button.is-loading {
    position: relative;
    pointer-events: none;
    padding: 3px 6px;
  }
</style>
